<?php
$store = Mage::app()->getStore();
$code  = $store->getCode();
    $_enable = Mage::getStoreConfig('stores/general/trego_store_enabled', $code);
    if($_enable){
        $_apikey = Mage::getStoreConfig('stores/general/trego_store_apikey', $code);
        $_address = Mage::getStoreConfig('stores/general/trego_store_address', $code);
        $_zoom = Mage::getStoreConfig('stores/general/trego_store_zoom', $code);
        $_center_lat = Mage::getStoreConfig('stores/general/trego_store_center_lat', $code);
        $_center_lng = Mage::getStoreConfig('stores/general/trego_store_center_lng', $code);
?>    
    <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=<?php echo $_apikey; ?>&sensor=true"></script>
    <script type="text/javascript">
        function initialize() {
            var pos = new google.maps.LatLng(<?php echo $_center_lat; ?>, <?php echo $_center_lng; ?>);
            var mapOptions = {
                center: pos,
                zoom: <?php echo $_zoom; ?>,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };
            var map = new google.maps.Map(document.getElementById("store_map"), mapOptions);
            var marker = new google.maps.Marker({
                position: pos,
                map: map,
                title: '<?php echo $_address; ?>'
            });
        }
        google.maps.event.addDomListener(window, 'load', initialize);
    </script>
    
    <div id="store_map"></div>
<?php
    }
?>